<%--
 *  File:    DoctorEdit.jsp
 *  @Author: banshang 
 *  Date:    2010/06/30
 *
 *  Copyright (C) 2000 - 2010 Oval Technologies, Inc.
 *  All rights reserved. 
 *
 *  This software is the confidential and proprietary information of Oval 
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>


<%@ include file="/inc/SessionTimeout.inc"%>
<%@ page language="java"%>
<%@ page import="java.util.*"%>
<%@ page import="org.apache.log4j.Category"%>
<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow"%>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom"%>

<%
  //init param
  Category cat = Category.getInstance("jsp.DoctorEdit");
  String strModuleName = "ERM";
  String privilegeCode = "10904";
  String contextPath = request.getContextPath();
  HashMap userinfo = (HashMap)session.getAttribute("userinfo");
  
%>
<% //--------------------  include files list --%>
<%--@ include file="/inc/Security.inc" --%>
<%@ include file="/inc/PageDefault.inc"%>
<%@ include file="/inc/LocationDefault.inc"%>

<html>
<head>
<title>DoctorEdit</title>
<PageFlow:CheckPageFlow pageName="p_doctoredit" />
<%@ include file="/inc/CatchError.inc" %>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet"
	href="<%=contextPath %>/css/<%= strLanguageCode %>/main.css"
	type="text/css">
<script language="JavaScript" src="<%=contextPath %>/js/ScriptLib.js"></script>
<script language="JavaScript" src="<%=contextPath %>/js/Calendar.js"></script>
<script language="JavaScript">
function page_done()
{ 
  if(!checkForm(document.cform))
    return;
  var zipcode=document.cform.zipcode.value;
  if(zipcode==null || zipcode!=""){
    if(zipcode.length!=6){
     alert("请输入六位数字的邮编");
     return;
      }	
    }
  document.cform.actionname.value = "save";
  document.cform.target = "_self";
  formatDate(cform);
  //isRunning = true;
  __submitData("pageform",true);
}

var popwindow;

function page_selectRep(){
	if(popwindow!=null) popwindow.close();
    url = 'ContactSummaryForPop.jsp?<%= OvalTools.randomURL() %>&languagecode=<%= strLanguageCode %>&countrycode=CN&orgid=<%= userinfo.get("orgid")%>';
    attribute = 'height=400, width=500,top=100,left=100,toolbar=n0, menubar=no, scrollbars=yes, resizable=no, location=no, status=no';
	popwindow = window.open(url,'newwindow', attribute);
}

function page_selectHospital(){
	if(popwindow!=null) popwindow.close();
    url = 'HospitalSummaryForPop.jsp?<%= OvalTools.randomURL() %>&languagecode=<%= strLanguageCode %>&countrycode=CN&status=41';
    attribute = 'height=500, width=900,top=100,left=100,toolbar=n0, menubar=no, scrollbars=yes, resizable=no, location=no, status=no';
	popwindow = window.open(url,'newwindow', attribute);
}
 
function setHospital(id,code,name){
	document.cform.hpid.value=id;
	document.cform.hospitalcode.value=code;
	document.cform.hospitalname.value=name;
}
function setContact(id,code,name){
	document.cform.salesrepid.value=id;
	document.cform.username.value=code;
	document.cform.employeename.value=name;
}

function page_selectDept(){
	if(popwindow!=null) popwindow.close();
    url = 'StandardDeptSummaryForPop.jsp?<%= OvalTools.randomURL() %>&languagecode=<%= strLanguageCode %>&countrycode=CN&status=41';
    attribute = 'height=500, width=900,top=100,left=100,toolbar=n0, menubar=no, scrollbars=yes, resizable=no, location=no, status=no';
	popwindow = window.open(url,'newwindow', attribute);
}


function setDept(value,name){
	document.cform.standardsectionid.value=value;
	document.cform.deptname.value=name;
}


function page_isMail(obj) 
{ 
	if(obj.value!=""){
		var patrn = /^([A-Za-z0-9])(\w)+@(\w)+(\.)(com|com\.cn|net|cn|net\.cn|org|biz|info|gov|gov\.cn|edu|edu\.cn)/; 
		if(!patrn.exec(obj.value)) { 
		 alert("请输入格式正确的E-mail!");
		 obj.focus();
		}
	} 
}

function page_isMobil(obj) 
{ 
	if(obj.value!=""){
		var patrn = /^[0-9]{11}$/; 
		if(!patrn.exec(obj.value)) { 
		alert("请输入格式正确的手机号!");
		obj.focus(); 
		} 
	}
} 

function page_isIDCard(obj) 
{ 
	if(obj.value!=""){
		var patrn = /^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$/; 
		var patrn = /^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{4}$/; 
		if(!patrn.exec(obj.value)) { 
		alert("请输入格式正确的身份证号!"); 
		obj.focus();
		} 
	}
} 

function page_checkNullStr(obj){
	var str=obj.value;
	str = ( str || "" ).replace(/^\s+|\s+$/g, "");
	str = ( str || "" ).replace(/^\　+|\　+$/g, "");
	obj.value=str;
}
</script>
</head>
<%
String strDisplayFlag="";
if(request.getParameter("displayflag")!=null)
{
  strDisplayFlag=request.getParameter("displayflag");
}
String isEdit="";
if(request.getParameter("doctorid")!=null)
{
  isEdit="edit";
}
%>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" cellspacing="0" cellpadding="0">
	<tr>
		<td class="summary_top"></td>
	</tr>
</table>
<table width="100%" cellspacing="0" cellpadding="0">
	<form id="pageform" name="cform" method="post"
		action="<%=contextPath %>/Dispatcher" target="_self">
		<input type="hidden" name="pagename" value="p_doctoredit"> 
		<custom:hidden property="actionname" /> 
		<custom:hidden name="doctorinfo" property="category" value="1" />
		 <custom:hidden property="doctorid" name="doctorinfo" /> 
		<custom:hidden property="flag" />
	<tr>
		<td valign="top">
		<table border="1" cellspacing="0" bordercolorlight="#999999"
			bordercolordark="#FFFFFF" align="center" width="100%" cellpadding="1">
			<%if(!(strDisplayFlag).equals("view")){%>
			<tr>
				<td colspan="4" class="td_right"><a onclick="page_done()"><custom:button
					type="2" label="L_Save" imgsrc="save_btn.gif" border="0" /></a></td>
			</tr>
			<%}%>
			<tr>
				<%
					HashMap doctorinfo = (HashMap)pageContext.getAttribute("doctorinfo");
					String doctorcode = (String)doctorinfo.get("doctorcode");
					if(doctorcode!=null){
				%>
				<td class="td-text" width="15%"><%= label.getLabelName("L_DoctorCode") + label.getLabelName("L_Colon") %></td>
				<td width="35%"><custom:text property="doctorcode" name="doctorinfo" readonly="true" style="border:0;width:100%"  /></td>
				<%}else{%>
				<td class="need" width="15%"><%= label.getLabelName("L_DoctorCode") + label.getLabelName("L_Colon") %></td>
				<td width="35%"><custom:text property="doctorcode" name="doctorinfo" readonly="true" style="border:0;width:100%" /></td>
				<%}%>
				<td class="need"><%= label.getLabelName("L_BelongHospital") + label.getLabelName("L_Colon") %></td>
				<td><custom:text name="doctorinfo" property="hospitalcode"  label="L_BelongHospital" /> 
				<custom:hidden property="hpid" command="notnull" name="doctorinfo" /> 
				<a onclick="javascript:page_selectHospital();"><custom:button type="3" label="L_Asterisk" imgsrc="flash.gif" border="0" /></a>
				<custom:text property="hospitalname" name="doctorinfo" readonly="readonly" size="20" command="notnull" label="L_BelongHospital" /></td>
			</tr>
			<tr>
				<td class="need"><%= label.getLabelName("L_DoctorName") + label.getLabelName("L_Colon") %></td>
				<td><custom:text property="doctorname" command="notnull" name="doctorinfo"
					 label="L_DoctorName" onchange="page_checkNullStr(this)"/></td>
				<td class="td-text"><%= label.getLabelName("L_DoctorEnglishName") + label.getLabelName("L_Colon") %></td>
				<td><custom:text property="englishname" name="doctorinfo" onchange="page_checkNullStr(this)"/></td>
			</tr>
			<tr>
				<td class="td-text"><%= label.getLabelName("L_Gender") + label.getLabelName("L_Colon") %></td>
				<td><custom:selectdic name="doctorinfo" dictType="Gender"
					property="gender" defaultValue="----"/></td>
				<td class="need"><%= label.getLabelName("L_StandardDept") + label.getLabelName("L_Colon") %></td>
				<td><font style="display: none;"><custom:text name="doctorinfo" property="standardsectionid"  label="L_StandardDept" /></font>  
				<custom:text property="deptname" name="doctorinfo" readonly="readonly" size="20" command="notnull" label="L_StandardDept" />
				<a onclick="javascript:page_selectDept();"><custom:button type="3" label="L_Asterisk" imgsrc="flash.gif" border="0" /></a>
				</td>	
			</tr>
			<tr>
				<td class="td-text"><%= label.getLabelName("L_NativePlace") + label.getLabelName("L_Colon") %></td>
				<td><custom:text property="nativeplace" name="doctorinfo"
					label="L_NativePlace" onchange="page_checkNullStr(this)"/></td>
					<td class="need"><%= label.getLabelName("L_Reality_BusinessType") + label.getLabelName("L_Colon") %></td>
              <td>
                   <custom:text property="departmentname" name="doctorinfo" label="L_Reality_BusinessType"></custom:text>
                   <custom:hidden name="doctorinfo" property="department" />
               </td>
			</tr>
			<tr>
               			<td class="need"><%= label.getLabelName("L_Status") + label.getLabelName("L_Colon") %></td>
				<td><custom:select optionsName="allstatus"
					optionValueKey="statusvalue" optionInnerTextKey="statusname"
					name="doctorinfo" label="L_StatusName" command="notnull" property="status" defaultValue="------"/></td>
					<td class="td-text"><%= label.getLabelName("L_Birthday2") + label.getLabelName("L_Colon") %></td>
				<td>
				<custom:text property="birthday" dataType="date" name="doctorinfo" dataFormatName="dateformat" size="20"  label="L_GraduationTime" onfocus="c.show(this,'cform.birthday','yyyy-MM-dd')" />
				
				</td>
			</tr>
			<tr>
				<td class="td-text"><%= label.getLabelName("L_Birthday1") + label.getLabelName("L_Colon") %></td>
				<td>
				 <custom:text property="birthdaycn" dataType="date" name="doctorinfo" dataFormatName="dateformat" size="20"  label="L_GraduationTime" onfocus="c.show(this,'cform.birthdaycn','yyyy-MM-dd')" />
				</td>
				<td class="td-text"><%= label.getLabelName("L_IDNumber") + label.getLabelName("L_Colon") %></td>
				<td><custom:text property="idcardno" name="doctorinfo"
					onblur="page_isIDCard(this)" label="L_IDNumber" /></td>
			</tr>
			<tr>
				<td class="td-text"><%= label.getLabelName("L_GraduatedFrom") + label.getLabelName("L_Colon") %></td>
				<td><custom:text property="college" name="doctorinfo" label="L_GraduatedFrom" /></td>
				<td class="td-text"><%= label.getLabelName("L_Profession") + label.getLabelName("L_Colon") %></td>
				<td><custom:text property="profession" name="doctorinfo" label="L_Profession" /></td>
			</tr>
			<tr>
				<td class="td-text"><%= label.getLabelName("L_GraduationTime") + label.getLabelName("L_Colon") %></td>
				<td>
				 <custom:text property="graduatedate" dataType="date" name="doctorinfo" dataFormatName="dateformat" size="20"  label="L_GraduationTime" onfocus="c.show(this,'cform.graduatedate','yyyy-MM-dd')" />
					</td>
					<td class="td-text"><%= label.getLabelName("L_HomeAddress") + label.getLabelName("L_Colon") %></td>
				<td><custom:text property="address" name="doctorinfo" label="L_HomeAddress" /></td>
			</tr>
			<tr>
				<td class="td-text"><%= label.getLabelName("L_ZipCode") + label.getLabelName("L_Colon") %></td>
				<td><custom:text property="zipcode" name="doctorinfo"
					command="notnegative" dataType="number" label="L_ZipCode" /></td>
					<td class="td-text"><%= label.getLabelName("L_Interests") + label.getLabelName("L_Colon") %></td>
				<td><custom:text property="interest" name="doctorinfo" label="L_Interests" /></td>
			</tr>
			<tr>
				<td class="td-text"><%= label.getLabelName("L_OfficePhone") + label.getLabelName("L_Colon") %></td>
				<td><custom:text name="doctorinfo" property="telephone" label="L_OfficePhone"></custom:text></td>
				<td class="td-text"><%= label.getLabelName("L_MobilePhone") + label.getLabelName("L_Colon") %></td>
				<td><custom:text name="doctorinfo" property="cellphone"
					onblur="page_isMobil(this)" label="L_MobilePhone" ></custom:text></td>
			</tr>
			<tr>
				<td class="td-text"><%= label.getLabelName("L_Email") + label.getLabelName("L_Colon") %></td>
				<td><custom:text property="email" name="doctorinfo"
					onblur="page_isMail(this)" label="L_Email" /></td>
					<td class="td-text"><%= label.getLabelName("L_SocialTitle") + label.getLabelName("L_Colon") %></td>
				<td><custom:text property="societytitle" name="doctorinfo" label="L_SocialTitle" /></td>
			</tr>
			<tr>
				<td class="td-text"><%= label.getLabelName("L_Comments") + label.getLabelName("L_Colon") %></td>
				<td colspan="3"><custom:text property="comments" name="doctorinfo" size="50" label="L_SocialTitle" /></td>
			</tr>
		</table>
		</td>
	</tr>
	<tr>
		<td class="summary_top"></td>
	</tr>
	<tr>
      <td class="td_center">
	    <a onclick="__back()"><custom:button type="2" label="L_Back" imgsrc="delete.gif" border="0" style="width:60"/></a>
      </td>		
    </tr>
	</form>
</table>
</body>
<script>
  var list=document.getElementsByTagName("input");
  m=list.length
  list[m-1].style.display='none';
</script>
</html>